package com.sinosoft.cloud.access.handler;

import com.sinosoft.cloud.access.entity.TranData;
import com.sinosoft.cloud.access.net.MessageObject;
import com.sinosoft.cloud.access.transformer.Trans;
import io.netty.channel.ChannelHandlerContext;

/**
 * cloud-netty
 *
 * @title: cloud-netty
 * @package: com.sinosoft.cloud.access.handler
 * @author: yangming
 * @date: 2017/12/4 下午6:13
 */
public class TranDataToMessageHandler extends AbstractHandler {
    @Override
    MessageObject dealMessage(ChannelHandlerContext ctx, MessageObject messageObject) {
        Trans xsltTrans = getTrans();
        String msg = xsltTrans.tranDataToMsg(messageObject.getTranData());
        messageObject.setSendToBankMsg(msg);
        messageObject.setNext(MessageObject.Type.fireChannelRead);
        return messageObject;
    }
}
